package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllFacultyresearchs", query = "select myFacultyresearch from Facultyresearch myFacultyresearch"),
		@NamedQuery(name = "findFacultyresearchByFacultyResearchId", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.facultyResearchId = ?1"),
		@NamedQuery(name = "findFacultyresearchByMinumumRequirements", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.minumumRequirements = ?1"),
		@NamedQuery(name = "findFacultyresearchByMinumumRequirementsContaining", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.minumumRequirements like ?1"),
		@NamedQuery(name = "findFacultyresearchByPrimaryKey", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.facultyResearchId = ?1"),
		@NamedQuery(name = "findFacultyresearchByResearchDescription", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.researchDescription = ?1"),
		@NamedQuery(name = "findFacultyresearchByResearchDescriptionContaining", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.researchDescription like ?1"),
		@NamedQuery(name = "findFacultyresearchByResearchStatus", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.researchStatus = ?1"),
		@NamedQuery(name = "findFacultyresearchByResearchStatusContaining", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.researchStatus like ?1"),
		@NamedQuery(name = "findFacultyresearchByTitle", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.title = ?1"),
		@NamedQuery(name = "findFacultyresearchByTitleContaining", query = "select myFacultyresearch from Facultyresearch myFacultyresearch where myFacultyresearch.title like ?1") })
@Table(catalog = "ThesisManagement", name = "FacultyResearch")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Facultyresearch")
@XmlRootElement(namespace = "rms_test/edu/unf/cen6940/domain")
public class Facultyresearch implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "facultyResearchID", nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer facultyResearchId;
	/**
	 */

	@Column(name = "title", length = 100, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String title;
	/**
	 */

	@Column(name = "researchDescription", length = 1024, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String researchDescription;
	/**
	 */

	@Column(name = "researchStatus", length = 8, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String researchStatus;
	/**
	 */

	@Column(name = "minumumRequirements", length = 1024)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String minumumRequirements;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "facultyID", referencedColumnName = "facultyID", nullable = false) })
	@XmlTransient
	Faculty faculty;
	/**
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(catalog = "ThesisManagement", name = "KeywordToFacultyResearch", joinColumns = { @JoinColumn(name = "facultyResearchID", referencedColumnName = "facultyResearchID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "researchKeywordID", referencedColumnName = "researchKeywordID", nullable = false, updatable = false) })
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Researchkeyword> researchkeywords;
	/**
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(catalog = "ThesisManagement", name = "FacultyResearchToCategory", joinColumns = { @JoinColumn(name = "facultyResearchID", referencedColumnName = "facultyResearchID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "categoryID", referencedColumnName = "categoryID", nullable = false, updatable = false) })
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Category> categories;
	/**
	 */
	@OneToMany(mappedBy = "facultyresearch", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Facultyresearchtostudent> facultyresearchtostudents;

	/**
	 */
	public void setFacultyResearchId(Integer facultyResearchId) {
		this.facultyResearchId = facultyResearchId;
	}

	/**
	 */
	public Integer getFacultyResearchId() {
		return this.facultyResearchId;
	}

	/**
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 */
	public String getTitle() {
		return this.title;
	}

	/**
	 */
	public void setResearchDescription(String researchDescription) {
		this.researchDescription = researchDescription;
	}

	/**
	 */
	public String getResearchDescription() {
		return this.researchDescription;
	}

	/**
	 */
	public void setResearchStatus(String researchStatus) {
		this.researchStatus = researchStatus;
	}

	/**
	 */
	public String getResearchStatus() {
		return this.researchStatus;
	}

	/**
	 */
	public void setMinumumRequirements(String minumumRequirements) {
		this.minumumRequirements = minumumRequirements;
	}

	/**
	 */
	public String getMinumumRequirements() {
		return this.minumumRequirements;
	}

	/**
	 */
	public void setFaculty(Faculty faculty) {
		this.faculty = faculty;
	}

	/**
	 */
	public Faculty getFaculty() {
		return faculty;
	}

	/**
	 */
	public void setResearchkeywords(Set<Researchkeyword> researchkeywords) {
		this.researchkeywords = researchkeywords;
	}

	/**
	 */
	public Set<Researchkeyword> getResearchkeywords() {
		if (researchkeywords == null) {
			researchkeywords = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Researchkeyword>();
		}
		return researchkeywords;
	}

	/**
	 */
	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	/**
	 */
	public Set<Category> getCategories() {
		if (categories == null) {
			categories = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Category>();
		}
		return categories;
	}

	/**
	 */
	public void setFacultyresearchtostudents(Set<Facultyresearchtostudent> facultyresearchtostudents) {
		this.facultyresearchtostudents = facultyresearchtostudents;
	}

	/**
	 */
	public Set<Facultyresearchtostudent> getFacultyresearchtostudents() {
		if (facultyresearchtostudents == null) {
			facultyresearchtostudents = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearchtostudent>();
		}
		return facultyresearchtostudents;
	}

	/**
	 */
	public Facultyresearch() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Facultyresearch that) {
		setFacultyResearchId(that.getFacultyResearchId());
		setTitle(that.getTitle());
		setResearchDescription(that.getResearchDescription());
		setResearchStatus(that.getResearchStatus());
		setMinumumRequirements(that.getMinumumRequirements());
		setFaculty(that.getFaculty());
		setResearchkeywords(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Researchkeyword>(that.getResearchkeywords()));
		setCategories(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Category>(that.getCategories()));
		setFacultyresearchtostudents(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearchtostudent>(that.getFacultyresearchtostudents()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("facultyResearchId=[").append(facultyResearchId).append("] ");
		buffer.append("title=[").append(title).append("] ");
		buffer.append("researchDescription=[").append(researchDescription).append("] ");
		buffer.append("researchStatus=[").append(researchStatus).append("] ");
		buffer.append("minumumRequirements=[").append(minumumRequirements).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((facultyResearchId == null) ? 0 : facultyResearchId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Facultyresearch))
			return false;
		Facultyresearch equalCheck = (Facultyresearch) obj;
		if ((facultyResearchId == null && equalCheck.facultyResearchId != null) || (facultyResearchId != null && equalCheck.facultyResearchId == null))
			return false;
		if (facultyResearchId != null && !facultyResearchId.equals(equalCheck.facultyResearchId))
			return false;
		return true;
	}
}
